home *** CD-ROM | disk | FTP | other *** search
- public class DoorPivotSwitchPivot extends Codex {
- private float _duration = 3.0F;
- private float _openTime;
- private CodexThing _switchThing;
- private CodexThing door;
- private int doorGuid;
- private boolean bOpen;
- private boolean bActive;
- private boolean bSwitchActive;
- public static String[] _params = new String[]{"Duration;3.0", "Switch Time;0", "Switch"};
-
- public void clicked(int guid, int clickerGuid, int captureId) {
- if (!this.bActive && !this.bSwitchActive) {
- if (guid == this.doorGuid) {
- new CodexSound("locked_large_02.WAV", 300.0F, 600.0F, 100, 0, 0, clickerGuid);
- CodexConsole.PrintNLS(clickerGuid, 0, "GEN_OPENELSEWHERE");
- } else {
- this.bActive = true;
- if (!this.bOpen) {
- this._switchThing.RotatePivot(1, this._openTime);
- this.door.RotatePivot(1, this._duration);
- this.bOpen = true;
- } else {
- this._switchThing.RotatePivot(1, -this._openTime);
- this.door.RotatePivot(1, -this._duration);
- this.bOpen = false;
- }
-
- }
- }
- }
-
- public void beginscene(int clientGuid, int captureID) {
- this.door.SetThingFlags(8192);
- }
-
- public void arrived(int thingGuid, int frameNum, int captureId) {
- if (thingGuid == this.door.GetGUID()) {
- this.bActive = false;
- }
-
- if (thingGuid == this._switchThing.GetGUID()) {
- this.bSwitchActive = false;
- }
-
- }
-
- public void restore(int flags) {
- this.bOpen = CodexSequence.RestoreBoolean();
- }
-
- public DoorPivotSwitchPivot(float duration, float openTime, CodexThing switchThing) {
- this._duration = duration;
- this._openTime = openTime;
- this._switchThing = new CodexThing(((Codex)switchThing).GetGUID());
- ((Codex)this).CaptureThing(this._switchThing.GetGUID());
- this.doorGuid = ((Codex)this).GetClassThing();
- this.door = new CodexThing(this.doorGuid);
- if (this.door.GetDescriptionID().equalsIgnoreCase("PROP")) {
- this.door.SetDescriptionID("GEN_DOOR");
- }
-
- if (this._switchThing.GetDescriptionID().equalsIgnoreCase("PROP")) {
- this._switchThing.SetDescriptionID("GEN_SWITCH");
- }
-
- }
-
- public void save(int flags) {
- CodexSequence.SaveBoolean(this.bOpen);
- }
- }
-